#! /bin/bash

checkError() {
    error=$?

    if [ $error -ne 0 ]; then
        echo "found error: $error"
        exit $error
    fi
}

export program_name=my-golang-app
export ssh_server=root@39.104.25.252
export product_installer_home="/root"

echo "uploading app to ${ssh_server} ..."
scp -Cqr -P 22 ./${program_name}.tar.bz2 "${ssh_server}:${product_installer_home}"

echo "unzip the packager ..."
ssh ${ssh_server} 'bash -s' <./start_server.sh
